package com.onLineCar.manages.api;

import com.onLineCar.common.core.domain.Result;
import com.onLineCar.manages.api.dto.ApiVehicleBaseInfo;
import com.onLineCar.manages.api.dto.ApiVehicleInfoDTO;
import com.onLineCar.manages.service.api.ApiVehicleInfoService;
import com.onLineCar.manages.web.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("api/vehicle-info")
@Slf4j
public class ApiVehicleInfoController extends BaseController {

    @Autowired
    private ApiVehicleInfoService vehicleInfoService;

    @GetMapping("/supportCity")
    public Result<Integer> supportCity(@RequestParam String district) {
        return Result.success(vehicleInfoService.supportCity(district));
    }

    @GetMapping("/queryAllVehicleInfo")
    public Result<List<ApiVehicleInfoDTO>> queryAllVehicleInfo() {
        return Result.success(vehicleInfoService.queryAllVehicleInfo());
    }

    @PostMapping("/batchQueryVehicleInfo")
    public Result<List<ApiVehicleInfoDTO>> queryVehicleInfoByVehicleIds(@RequestBody List<Integer> vehicleIds) {
        return Result.success(vehicleInfoService.queryVehicleInfoByVehicleIds(vehicleIds));
    }

    @GetMapping("/driverService")
    public Result<Boolean> driverService(@RequestParam("district") String district){
        return Result.success(vehicleInfoService.driverService(district));
    }

    @GetMapping("/havaBillingRule")
    public Result<Boolean> havaBillingRule(@RequestParam("district") String district){
        return Result.success(vehicleInfoService.havaBillingRule(district));
    }


    @GetMapping("/selectAllVehicleBaseInfo")
    public Result<List<ApiVehicleBaseInfo>> selectAllVehicleBaseInfo(){
        return Result.success(vehicleInfoService.selectAllVehicleBaseInfo());
    }

}
